{extend name="template/order" /}
{block name="content"}

<div class="page">
  <div class="fixed-bar">
    <div class="item-title">
      <h3>订单管理</h3>
      <ul class="tab-base">
        <li><a href="{:url('admin/order.order/index')}"><span>管理</span></a></li>
        <li><a href="JavaScript:void(0);" class="current"><span>确认到款</span></a></li>
      </ul>
    </div>
  </div>
  <div class="fixed-empty"></div>
  <form method="post" name="form1" id="form1" action="/?s=admin/order.order/change_state&state_type=offline_receive_pay&order_id=<?php echo intval($_GET['order_id']);?>">
    <input type="hidden" name="is_pass" id="is_pass" value="1"/>
    <table class="table tb-type2">
      <tbody>
        <tr class="noborder">
          <td colspan="2" class="required"><label for="site_name">订单编号： </label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><?php echo $order_info['order_sn'];?></td>
          <td class="vatop tips"></td>
        </tr>
        <?php if ($_GET['act'] == 'order') { ?>
        <tr class="noborder">
          <td colspan="2" class="required"><label for="site_name">支付单号：</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><?php echo $order_info['pay_sn'];?></td>
          <td class="vatop tips"></td>
        </tr>
        <?php } ?>
        <tr class="noborder">
          <td colspan="2" class="required"><label for="site_name">订单总金额 ：</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><?php echo $order_info['order_amount'];?></td>
          <td class="vatop tips"></td>
        </tr>
        <tr class="noborder">
          <td colspan="2" class="required"><label for="site_name">付款方式： 线下支付</label></td>
        </tr>
        <tr class="noborder">
          <td colspan="2" class="required"><label for="site_name">付款时间：</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><input readonly id="payment_time" class="" name="payment_time" value="" type="text" /></td>
          <td class="vatop tips"></td>
        </tr>
        <tr class="noborder">
          <td colspan="2" class="required"><label for="site_name">付款凭证：</label></td>
        </tr>
        <tr class="noborder">
          <td class="vatop rowform"><img src="<?php echo img_url($order_pay['order_crimg']); ?>"/></td>
          <td class="vatop tips"></td>
        </tr>
        
      </tbody>
      <tfoot id="submit-holder">
        <tr class="tfoot">
          <td colspan="2" >
          	<a href="JavaScript:void(0);" id="ncsubmit" class="btn"><span>确认到款</span></a>
          	<a href="JavaScript:void(0);" id="nopass_submit" class="btn"><span>凭证不通过</span></a>
          </td>
        </tr>
      </tfoot>
    </table>
  </form>
</div>
<script type="text/javascript" src="/old/data/resource/js/jquery-ui/jquery.ui.js"></script> 
<script type="text/javascript" src="/old/data/resource/js/jquery-ui/i18n/zh-CN.js" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="/old/data/resource/js/jquery-ui/themes/ui-lightness/jquery.ui.css"  />
<script type="text/javascript">
$(function(){
	$('#payment_time').datepicker({dateFormat: 'yy-mm-dd',maxDate: '<?php echo date('Y-m-d',TIMESTAMP);?>'});
    $('#ncsubmit').click(function(){
	    	if($("#form1").valid()){
	        	if (confirm("操作提醒：\n该操作不可撤销\n提交前请务必确认是否已收到付款\n继续操作吗?")){
	        	}else{
	        		return false;
	        	}
	        	$('#form1').submit();
	    }    	
    });
    //审核不通过凭证
    $('#nopass_submit').click(function(){
    		$('#is_pass').val(0);
    		if(confirm("操作提醒： \n请确认是否不通过此凭证\n继续操作吗?")){
    		}else{return false;}
    		$('#form1').submit();
    });
    $("#form1").validate({
			errorPlacement: function(error, element){
				error.appendTo(element.parent().parent().prev().find('td:first'));
	        },
	        rules : {
	        	payment_time : {
	                required : true
	            },
	        },
	        messages : {
	        	payment_time : {
	                required : '请填写付款准确时间'
	            },
	        }
		});
});
</script> 
{/block}